import { QXEvent } from 'qx-util';
import {
	IParam,
	TreeExpBarActionType,
	ITreeExpBarAbility,
	ITreeExpBarControllerParams,
	ITreeExpBarStore,
	TreeExpBarController,
	ICtrlEvent,
	ITreeExpBarController,
	ITreeExpBarModel,
} from '@/core';
import {
	useTreeExpBarAction,
	useTreeExpBarBasic,
	useTreeExpBarControllerParams,
	useTreeExpBarProps,
} from '@/hooks/widget/use-tree-exp-bar';
import { model } from './tree-exp-viewtreeexpbar-tree-exp-bar-model';
// 基于template/src/widgets/{{appEntities}}/{{ctrls@TREEEXPBAR}}-tree-exp-bar/{{spinalCase ctrl.codeName}}-tree-exp-bar-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useTreeExpBarProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useTreeExpBarBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useTreeExpBarAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<TreeExpBarActionType, ITreeExpBarAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<TreeExpBarActionType, ITreeExpBarAbility>>,
	otherParams: IParam = {}
): ITreeExpBarController<ITreeExpBarStore, ITreeExpBarAbility> {
	const params: ITreeExpBarControllerParams<
		TreeExpBarActionType,
		ITreeExpBarAbility
	> = useTreeExpBarControllerParams<ITreeExpBarStore, ITreeExpBarModel>(
		model,
		props,
		evt,
		otherParams
	);
	return new TreeExpBarController(params);
}
